/*
 * TCSS 360 - Winter 2014
 * TESK Software
 */
package view.userProfile;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.FlowLayout;
import javax.swing.JButton;
import java.awt.GridLayout;
import java.awt.Font;

import view.CurrentConference;
import view.LogInView;
import view.MainFrame;
import view.SelectConferenceReviewer;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import javax.swing.border.MatteBorder;

/**
 * Provides the reviewer with a view.
 * 
 * @author Kon.
 * @version 3/5/14
 */
@SuppressWarnings("serial")
public class ReviewerView extends JPanel{
	
	/** The frame the panel is associated with. */
	private MainFrame my_frame;
	
	/** The current panel used to pass to new panels. */
	private JPanel current_view;
	
	/**
	 * Constructs the reviewer view panel.
	 * 
	 * @param the_frame the frame to be associated with the panel.
	 */
	public ReviewerView(MainFrame the_frame) {
		my_frame = the_frame;
		current_view = this;
		setLayout(new GridLayout(3, 1, 0, 0));
		this.setBackground(Color.white);
		init();
	}
	
	/** 
	 * Adds specifications and components to the panel.
	 */
	private void init() {
		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new MatteBorder(4, 2, 1, 2, (Color) new Color(64, 64, 64)));
		FlowLayout flowLayout = (FlowLayout) panel_1.getLayout();
		flowLayout.setVgap(50);
		panel_1.setBackground(new Color(255, 255, 255));
		add(panel_1);
		//icon label
		
		ImageIcon icon = new ImageIcon(getClass().getResource("/bear.jpg"));
				final JLabel pic = new JLabel();
//				pic.setIcon(new ImageIcon("..\\Conference System\\src\\bear.jpg"));
				pic.setIcon(icon);
				panel_1.add(pic);
		JLabel lblWelcome = new JLabel("Welcome, Reviewer!");
		lblWelcome.setBackground(Color.WHITE);
		panel_1.add(lblWelcome);

		lblWelcome.setFont(new Font("Tahoma", Font.PLAIN, 18));
		
		JPanel basePanel = new JPanel();
		add(basePanel);
		basePanel.setBackground(new Color(224, 255, 255));
		basePanel.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(100, 25, 221, 75);
		panel.setBackground(Color.WHITE);
		basePanel.add(panel);
		panel.setLayout(new GridLayout(3, 0, 0, 0));

		JButton submitReviewButton = new JButton("Submit a Review");
		submitReviewButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
		submitReviewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				my_frame.setNewPanel(new SelectConferenceReviewer(my_frame, current_view));
			}
		});
		
		JButton currentConfButton = new JButton("View Current Conferences");
		currentConfButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
		currentConfButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				JFrame frame = new JFrame();
				CurrentConference current = new CurrentConference(my_frame);
				current.setup();
				frame.getContentPane().add(current);
				frame.setVisible(true);
				frame.setResizable(false);
				frame.pack();
				}
		});
		panel.add(currentConfButton);
		panel.add(submitReviewButton);

		final JButton logOut = new  JButton("Log Out");
		logOut.setFont(new Font("Tahoma", Font.PLAIN, 14));
		logOut.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				JPanel view = new LogInView(my_frame);
				my_frame.setNewPanel(view);
			}
		});
		panel.add(logOut);
		
		JPanel bottomPanel = new JPanel();
		bottomPanel.setBackground(Color.WHITE);
		add(bottomPanel);
		
		ImageIcon icon1 = new ImageIcon(getClass().getResource("/house.jpg"));
		final JLabel pic1 = new JLabel();
		//pic1.setIcon(new ImageIcon("..\\Conference System\\src\\house.jpg"));
		pic1.setIcon(icon1);
		bottomPanel.add(pic1);
	}
}
